<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
    <a-tabs default-active-key="1" style="background: #fff">
        <a-tab-pane key="1" tab="界面还原">
            <a-layout >
                <a-layout-sider style="background: #fff" >
                    <a-card :bordered="false" :style="clientHeight7">
                        <a-timeline>
                            <a-timeline-item @click="clickTest(timeLineItem,'finish')" v-for="timeLineItem in timeLineItems" :key="timeLineItem.oplogId">
                                <a-tooltip>
                                    <template slot="title">
                                        点击查看界面还原
                                    </template>
                                    <div>{{timeLineItem.actName}}|{{timeLineItem.operationName}}</div>
                                    <div>{{timeLineItem.opTime}}</div>
                                    <div>操作人:{{timeLineItem.opName}}</div>
                                    <div>审核状态:{{timeLineItem.authStatus}}</div>
                                    <div>审核意见:{{timeLineItem.authRemarks}}</div>
                                </a-tooltip>
                            </a-timeline-item>
                            <a-timeline-item   @click="clickTest(doingitem,'doing')" v-for="doingitem in timeLineDoing" :key="doingitem.executionId">
                                <a-icon slot="dot" type="loading" style="font-size: 16px;" />
                                <a-tooltip>
                                    <template slot="title">
                                        点击查看界面还原
                                    </template>
                                    <div>{{doingitem.actName}}</div>
                                    <div>操作人:{{doingitem.assigneeName}}</div>
                                    <div>办理中</div>
                                </a-tooltip>
                            </a-timeline-item>
                        </a-timeline>
                    </a-card>
                </a-layout-sider>
                <a-layout >
                    <a-layout-content style="background: #fff" >
                        <component :is="item" v-for="item in allComponents" :key="item" ref="component" :formData="formData" :style="clientHeight7" />
                    </a-layout-content>
                </a-layout>
                <a-layout-sider style="background: #fff;padding-left: 20px" >
                    <MaterialCheck :bordered="false" :style="clientHeight7" :materialBusNo="materialBusNo"/>
                </a-layout-sider>

                <div>
                    <a-modal
                            title="审核信息"
                            centered
                            style="top: 10px;"
                            width="40%"
                            destroyOnClose
                            v-model="auditVisible"
                            footer=""
                    >
                        <a-form-model ref="modelPage" :model="auditForm"  :label-col="auditLabelCol" :wrapper-col="auditWrapperCol">
                            <a-form-model-item label="下级签收人" v-if="assIdFlag">
                                <a-select
                                        placeholder="请选择"
                                        allowClear
                                        v-model="auditForm.assigneeId"
                                        style="margin-left: 8px;"
                                >
                                    <a-select-option v-for="item in dictData.assigneeId" :key="item.assigneeId" :value="item.assigneeId">{{ item.assigneeIdName }}</a-select-option>
                                </a-select>
                            </a-form-model-item>
                            <a-form-model-item label="下级签收用户" v-if="userIdFlag">
                                <a-select
                                        placeholder="请选择"
                                        allowClear
                                        v-model="auditForm.userId"
                                        style="margin-left: 8px;"
                                >
                                    <a-select-option v-for="item in dictData.userId" :key="item.userId" :value="item.userId">{{ item.userIdName }}</a-select-option>
                                </a-select>
                            </a-form-model-item>
                            <a-form-model-item label="审核意见">
                                <a-textarea  v-model="auditForm.shyj" :rows="4" />
                            </a-form-model-item>
                            <a-form-model-item label="审核操作">
                                <vxe-button :disabled="auditDisable" @click="approve('1')">审核通过</vxe-button>
                                <vxe-button :disabled="auditDisable" @click="approve('2')">审核不通过</vxe-button>
                            </a-form-model-item>
                        </a-form-model>
                    </a-modal>
                    <a-modal
                            title="驳回信息"
                            centered
                            style="top: 10px;"
                            width="30%"
                            destroyOnClose
                            v-model="callbackVisible"
                            :confirm-loading="callBackLoading"
                            @ok="callBackSave"
                            cancelText="关闭"
                            okText="驳回"
                    >
                        <a-form-model ref="modelPage" :model="callbackForm"  :label-col="callbackLabelCol" :wrapper-col="callbackWrapperCol">
                            <a-form-model-item label="驳回环节">
                                <a-select
                                        placeholder="请选择"
                                        allowClear
                                        v-model="callbackForm.backToActId"
                                        style="margin-left: 8px;"
                                >
                                    <a-select-option v-for="item in dictData.backToActId" :key="item.actId" :value="item.actId">{{ item.actName }}</a-select-option>
                                </a-select>
                            </a-form-model-item>
                            <a-form-model-item label="驳回意见">
                                <a-textarea  v-model="callbackForm.bhyj" row="4"/>
                            </a-form-model-item>
                        </a-form-model>
                    </a-modal>
                    <a-modal
                            title="转办信息"
                            centered
                            style="top: 10px;"
                            width="30%"
                            destroyOnClose
                            v-model="transferVisible"
                            :confirm-loading="transferLoading"
                            @ok="transferSave"
                            cancelText="关闭"
                            okText="转办"
                    >
                        <a-form-model  :model="transferForm"  :label-col="transferLabelCol" :wrapper-col="transferWrapperCol">
                            <a-form-model-item label="签收类型">
                                <a-select
                                        placeholder="请选择"
                                        allowClear
                                        v-model="transferForm.transferAssigneeType"
                                        style="margin-left: 8px;"
                                        @change="getTrunAssigneeId"
                                >
                                    <a-select-option v-for="item in transferAssTypeDict" :key="item.dictKey" :value="item.dictKey">{{ item.dictValue }}</a-select-option>
                                </a-select>
                            </a-form-model-item>
                            <a-form-model-item label="签收人" >
                                <a-select
                                        placeholder="请选择"
                                        allowClear
                                        v-if="!transferTreeFlag"
                                        v-model="transferForm.transferAssigneeId"
                                        style="margin-left: 8px;"
                                >
                                    <a-select-option v-for="item in transferAssIdDict" :key="item.dictKey" :value="item.dictKey">{{ item.dictValue }}</a-select-option>
                                </a-select>
                                <a-tree-select
                                        showSearch
                                        v-model="transferForm.transferAssigneeId"
                                        style="width: 100%"
                                        v-if="transferTreeFlag"
                                        :value="orgSelectTreeValue"
                                        :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
                                        treeNodeFilterProp="title"
                                        allowClear
                                        treeDefaultExpandAll
                                        :treeData="transferAssigneeTreeDict"
                                        @change="onChangeOrgSelectTree"
                                        @search="onSearchOrgSelectTree"
                                        @select="onSelectOrgSelectTree"
                                >
                                </a-tree-select>
                            </a-form-model-item>
                        </a-form-model>
                    </a-modal>
                </div>
            </a-layout>
        </a-tab-pane>
        <a-tab-pane key="2" tab="流程展示" force-render >
            <act-flow-image :imagePara="imagePara" :style="clientHeight7"/>
        </a-tab-pane>
        <a-button slot="tabBarExtraContent"  v-if="transferButtonFlag" style="margin-right: 50px;float:right;height: 30px" type="primary"  icon="user" @click="() =>{this.transfer()}">转办</a-button>
        <a-button slot="tabBarExtraContent"  v-if="false"  style="margin-right: 30px;float:right;height: 30px" type="primary" :style="{ display: tempSaveDisplay }" icon="save" @click="() =>{this.getComponentData()}">暂存审核经办</a-button>
        <a-button slot="tabBarExtraContent" style="margin-right: 30px;float:right;height: 30px" type="primary" :style="{ display: acceptDisplay }" icon="check" :loading="acceptLoading" @click="() =>{this.accept()}">签收</a-button>
        <a-button slot="tabBarExtraContent" style="margin-right: 30px;float:right;height: 30px" type="primary" :style="{ display: auditDisplay }" icon="edit" @click="() =>{this.audit()}">审核</a-button>
        <a-button slot="tabBarExtraContent" v-if="false" style="margin-right: 30px;float:right;height: 30px" type="primary" :style="{ display: entrustDisplay }" icon="user-add" @click="() =>{this.entrust()}">委派</a-button>
        <a-button slot="tabBarExtraContent" v-if="callbackFlag" style="margin-right: 30px;float:right;height: 30px" type="primary" :style="{ display: callBackDisplay }" icon="rollback" @click="() =>{this.callback()}">驳回</a-button>
        <a-button slot="tabBarExtraContent" v-if="false" style="margin-right: 30px;float:right;height: 30px" type="primary" :style="{ display: apostilleDisplay }" icon="import" @click="() =>{this.apostille()}">加签</a-button>
        <a-button slot="tabBarExtraContent" style="margin-right: 30px;float:right;height: 30px" type="primary" icon="download" @click="downloadZip">批量下载材料</a-button>
    </a-tabs>
</template>

<script>
    import { getBatchDict,getListByBusNo,getDataVO,getTrunTaskAssigneeType,getTrunTaskAssigneeId,downloadMaterialZip,downloadFileZip} from "@/services/system/api"
    import { getAssigneeList,taskClaim,taskComplete,getBackNodeList,backToStepTask,getFlowNodeDetialByFLowNodeId,getFlowNodeListByNodeId,turnTask} from "@/services/system/workflowApi"
    import FooterToolBar from '@/components/FooterToolbar'
    import ALayoutSider from "ant-design-vue/es/layout/Sider";
    import modal from 'ant-design-vue/es/modal'
    //import MissRePage from "@/pages/overview/MissRePage";
    import reauditConfig from "@/config/default/reaudit.config.js"
    import ActFlowImage from "@/pages/overview/ActFlowImage";
    import  MaterialCheck from "@/pages/overview/MaterialCheck";
    import ACol from "ant-design-vue/es/grid/Col";
    import ARow from "ant-design-vue/es/grid/Row";
    export default {
        name: 'CommonAudit',
        props:["comData"],
        components: {
            ARow,
            ACol,
            ALayoutSider,
            FooterToolBar,
            // MissRePage,
            ActFlowImage,
            MaterialCheck,
        },
        data(){
            return{
                //结束日志
                timeLineItems: null,
                //正在进行环节
                timeLineDoing:null,
                //数据字典
                dictData: {},
                //动态组件及数据
                allComponents:[],
                //动态还原界面更新数据接受
                allComponentsVo:{},
                formData:{editFlag:true},
                //按钮隐藏和显示
                //签收按钮
                acceptDisplay:'none',
                //审核按钮
                auditDisplay:'',
                //委派按钮
                entrustDisplay:'',
                //驳回按钮
                callBackDisplay:'',
                //加签按钮
                apostilleDisplay:'',
                //暂存审核经办
                tempSaveDisplay:'none',
                //审核窗口打开和关闭
                auditVisible:false,
                //审核窗口数据
                auditForm:{assigneeType:'',assigneeId:'',userId:'',shyj:''},
                //审核窗口布局
                auditLabelCol: {
                    xs: { span: 24 },
                    sm: { span: 8 }
                },
                auditWrapperCol: {
                    xs: { span: 24 },
                    sm: { span: 12 }
                },
                //还原页面标题
                titleRe:null,
                //驳回窗口打开和关闭
                callbackVisible:false,
                //驳回窗口参数
                callbackForm:{backToActId:'',taskId:'',bhyj:''},
                //驳回窗口布局
                callbackLabelCol: {
                    xs: { span: 24 },
                    sm: { span: 8 }
                },
                callbackWrapperCol: {
                    xs: { span: 24 },
                    sm: { span: 12 }
                },
                //浏览器高度70%
                clientHeight7:{"overflow":"scroll","height":(document.body.clientHeight*0.7)+'px'},
                //浏览器高度60%
                clientHeight6:{"overflow":"scroll","height":(document.body.clientHeight*0.6)+'px'},
                //实例图片入参
                imagePara:{busNo: this._props.comData.busNo,procInstId:this._props.comData.procInstId},
                //流水号材料列表查询入参
                materialBusNo:{busNo:this._props.comData.busNo,procInstId:this._props.comData.procInstId,operationType:this._props.comData.operationType},
                //下级签收人是否显示
                assIdFlag:true,
                //下级签收用户是否显示
                userIdFlag:false,
                //当前业务申请人
                applyUserId:'',
                //当前可编辑还原页面是否信息完整
                infoCompleteFlag:true,
                //动态传值下级签收人
                auAssId:'',
                transferButtonFlag:false,
                callbackFlag:true,
                //转办窗口打开和关闭
                transferVisible:false,
                //转办窗口参数
                transferForm:{transferAssigneeType:'',taskId:this._props.comData.taskId,transferAssigneeId:''},
                //转办窗口布局
                transferLabelCol: {
                    xs: { span: 24 },
                    sm: { span: 8 }
                },
                transferWrapperCol: {
                    xs: { span: 24 },
                    sm: { span: 12 }
                },
                //签收类型数据字典
                transferAssTypeDict:[],
                //签收人字典
                transferAssIdDict:[],
                //签收人树字典
                transferAssigneeTreeDict:[],
                orgSelectTreeValue:undefined,
                //是否显示转办签收树
                transferTreeFlag:false,
                //审核按钮置灰
                auditDisable:false,
                //驳回保存按钮置灰
                callBackLoading: false,
                //转办按钮置灰
                transferLoading:false,
                //签收按钮是否处于加载状态
                acceptLoading:false,

            }
        },
        created() {
            // 数据初始化
            const params = {}
            params.dictFields = 'assigneeType'
            this.$http.post(getBatchDict,params).then(res => {
                this.dictData = res.result;
            })
            this.getOplogList();
            //判断当前签收状态是否需要签收
            if(this._props.comData.status=='wait_claim'){
                //需要签收
                this.acceptDisplay='';
                this.auditDisplay='none';
                this.entrustDisplay='none';
                this.callBackDisplay='none';
                this.apostilleDisplay='none';
            }

            const param={};
            param.id=this._props.comData.flowNodeId;
            this.$http.post(getFlowNodeDetialByFLowNodeId,param).then((res)=>{
                if(res.result){
                    //判断是否配置转办类型用于判断转办按钮是否显示
                    if(res.result.turnTaskType==undefined||res.result.turnTaskType==''){
                        this.transferButtonFlag=false;
                    }else {
                        this.transferButtonFlag=true;
                    }

                    //判断是否配置判断驳回按钮是否显示
                    if(res.result.callbackFlag==undefined||res.result.callbackFlag==''||res.result.callbackFlag=='1'){
                        this.callbackFlag=true;
                    }else {
                        this.callbackFlag=false;
                    }

                }
            }).catch();

        },
        methods:{
            // 发送请求获取日志列表数据
            getOplogList(){
                //重新加载默认组件
                // this.allComponents=["MissRePage"];
                var param={
                    "automaticFlag": true,
                    "busNo": this._props.comData.busNo,
                    "rollbackFlag": false
                };
                this.$http.post(getListByBusNo,param).then((res) => {
                    //已办环节时间轴
                    var finishList=res.result.finishList;
                    this.timeLineItems=[];
                    for(var z=0;z<finishList.length;z++){
                        if(finishList[z].commentType!='QS'){
                            this.timeLineItems.push(finishList[z]);
                        }
                    }
                    var oplog='';

                    //是否存在待办业务
                    if(res.result.doingFlag==true){
                        //加载当前环节经办页面
                        var doingList=res.result.doingList;
                        this.timeLineDoing=doingList;
                        //默认打开审核页面界面还原
                        oplog=doingList[0];
                        if(oplog.opUserId!=undefined&&oplog.opUserId!=null&&oplog.opUserId!='') {
                            if(oplog.formKey!=undefined&&oplog.formKey!=null&&oplog.formKey!=''){
                                 if(this.getUserInfo(oplog.opUserId)){
                                     this.clickTest(oplog,'doing');
                                     return;
                                 }
                            }
                        }
                    }

                    //默认还原界面选取启动节点,若不存在启动节点则默认第一笔操作日志
                    oplog=finishList[0];
                    //this.$refs.userBaseInfo.getBaseInfo(oplog.opUserId);
                    for(var i=0;i<finishList.length;i++){
                        if(finishList[i].formKey!=undefined&&finishList[i].formKey!=null&&finishList[i].formKey!=''){
                            oplog= finishList[i];
                            this.clickTest(oplog,'finish');
                            return;
                        }
                    }

                }).catch(() => {

                })
            },
            //获取界面还原更新数据
            getComponentData(){
                var allComponents=this.allComponents;
                //遍历组件拿到审核经办界面的数组暂存
                for (var i=0;i<allComponents.length;i++){
                    var name=allComponents[i];
                    //调用组件方法拿取组件数据
                    this.$refs.component[i].tempSave();
                    this.allComponentsVo[name]=this.$refs.component[i].componentVo;
                    if(this.$refs.component[i].editFlag==false){
                        if(this.$refs.component[i].infoCompleteFlag!=undefined){
                            this.infoCompleteFlag=this.$refs.component[i].infoCompleteFlag;
                        }
                        if(this.$refs.component[i].auAssId!=undefined&&this.$refs.component[i].auAssId!=''){
                            this.auAssId=this.$refs.component[i].auAssId;
                        }
                    }
                }
            },
            //获取用户登录信息判断登录用户与操作用户是否一致
            getUserInfo(userId){
                let accessToken=this.$store.state.user.accessToken;
                if(accessToken){
                    let userInfo=this.$store.state.user.userInfo;
                    //超级管理员不控制权限
                    for(let x=0;x<userInfo.systemPrivileges.length;x++){
                        if(userInfo.systemPrivileges[x]=="SUPERADMIN"){
                            return true;
                        }
                    };

                    if(userId==userInfo.userId){
                        return true;
                    } else{
                        return false;
                    }
                }else{
                    this.$notification.error({
                        message: '登录提示',
                        description: `未登录,请先登录`
                    })
                    return false;
                }
            },
            //根据oplog查询还原界面和数据进行还原
            clickTest(oplog,type){
                if(this.allComponents){
                    //判断是否需要调用暂存方法
                    if(this.formData.editFlag==false){
                        this.getComponentData();
                    }
                }
                //隐藏暂存审核经办数据
                this.tempSaveDisplay='none';
                this.titleRe=oplog.actName;

                //当前点击日志办理状态
                if(type=='doing'){
                    if(oplog.formKey!=undefined&&oplog.formKey!=null&&oplog.formKey!=''){
                        var str=oplog.formKey;
                        var formKeyList= new Array(); //定义一数组
                        formKeyList=str.split(","); //字符分割
                        if(formKeyList.length!=0){

                            if(oplog.opUserId==null){
                                this.formData={editFlag:true,busNo:oplog.busNo,name:this._props.comData.name};
                            }else{
                                if(this.getUserInfo(oplog.opUserId)){
                                    this.importComponets(formKeyList);
                                    //当前登录账户是审核账号显示审核经办暂存按钮
                                    this.tempSaveDisplay='';
                                    this.formData={editFlag:false,name:this._props.comData.name,busNo:oplog.busNo,componentVo:this.allComponentsVo};
                                }
                                else{
                                    this.formData={editFlag:true,name:this._props.comData.name};
                                }
                            }
                        }
                    }
                    //else{
                    // this.allComponents=["MissRePage"];
                    //}
                }
                if(type=='finish'){
                    this.formData={editFlag:true};
                    //根据日志节点id查询对应的还原组件和还原数据
                    var param={
                        "busNo": oplog.busNo,
                        "oplogId": oplog.oplogId
                    };
                    this.$http.post(getDataVO,param).then((res) => {

                        if(res.result.formKeyList==undefined){
                            //this.allComponents=["MissRePage"];
                            this.formData.editFlag=true;
                        }else {
                            this.importComponets(res.result.formKeyList);
                            //当前页面不可编辑
                            res.result.formData.editFlag=true;
                            this.formData=res.result.formData;
                        }
                    }).catch(() => {

                    })
                }
            },
            //签收
            accept(){
                this.acceptLoading=true;
                //发送签收请求
                let param={
                    "taskId": this._props.comData.taskId,
                    "busNo":this._props.comData.busNo,
                    "flowNodeId": this._props.comData.flowNodeId
                };
                this.$http.post(taskClaim,param).then(() => {
                    this.acceptLoading=false;
                    alert("签收成功")
                    this.acceptDisplay='none';
                    this.auditDisplay='';
                    this.entrustDisplay='';
                    this.callBackDisplay='';
                    this.apostilleDisplay='';
                    //签收成功刷新左侧日志
                    this.getOplogList();
                }).catch(() => {
                    this.acceptLoading=false;
                })
            },
            //审核
            audit(){
                /*const param={};
                param.id=this._props.comData.flowNodeId;
                this.$http.post(getFlowNodeDetialByFLowNodeId,param).then((res)=>{
                    if(res.result){
                        if(res.result.assigneeTypeName){
                            this.auditForm.assigneeTypeName=res.result.assigneeTypeName;
                            this.auditForm.assigneeType=res.result.assigneeType;
                            this.assTypeFlag=true;
                        }else {
                            this.assTypeFlag=false;
                        }

                    }
                }).catch();*/
                this.getComponentData();
                if(this.auAssId!=undefined&&this.auAssId!=''){
                    this.auditForm.assigneeId=this.auAssId;
                    this.assIdFlag=false;
                    this.auditVisible=true;
                }else{
                    const params={};
                    params.flowNodeId=this._props.comData.flowNodeId;
                    params.procDefId=this._props.comData.procDefId;
                    this.$http.post(getFlowNodeListByNodeId,params).then((res)=>{
                        if(res.result.length==1){
                            const params2={};
                            params2.nodeId=res.result[0].id;
                            this.$http.post(getAssigneeList,params2).then((res) => {
                                this.dictData.assigneeId=[];
                                this.dictData.userId=[];
                                if(res.result.length>0){
                                    this.auditForm.assigneeType=res.result[0].assigneeType;
                                    if(res.result.length==1){
                                        this.auditForm.assigneeId=res.result[0].assigneeId;
                                        this.assIdFlag=false;
                                    }else{
                                        for(let i=0;i<res.result.length;i++){
                                            var assigneeId=res.result[i].assigneeId;
                                            var assigneeIdName=res.result[i].assigneeIdName;
                                            var userId=res.result[i].userId;
                                            var userIdName=res.result[i].userIdName;
                                            this.dictData.assigneeId.push({
                                                "assigneeId": assigneeId,
                                                "assigneeIdName": assigneeIdName,
                                            });
                                            if(userId!=undefined&&userId!=''){
                                                this.dictData.userId.push({
                                                    "userId": userId,
                                                    "userIdName": userIdName,
                                                });
                                            }
                                        }
                                    }
                                }


                                if(this.dictData.assigneeId.length==0){
                                    this.assIdFlag=false;
                                }else{
                                    this.assIdFlag=true;
                                }
                                if(this.dictData.userId.length==0){
                                    this.userIdFlag=false;
                                }else{
                                    this.userIdFlag=true;
                                }
                                this.auditVisible=true;
                            }).catch(() => {

                            })
                        }else{
                            this.assIdFlag=false;
                            this.userIdFlag=false;
                            this.auditVisible=true;
                        }
                    });
                }
            },
            //委派
            entrust(){

            },
            //转办
            transfer(){
                let param={};
                param.taskId=this.transferForm.taskId;
                //发送请求获取转办类型
                this.$http.post(getTrunTaskAssigneeType,param).then((res) => {
                    if(res.result.length>0){
                        this.transferVisible=true;
                        this.transferAssTypeDict=res.result;
                    }
                }).catch(() => {

                })
            },
            //转办保存
            transferSave(){
                this.transferLoading=true;
                if(this.transferForm.transferAssigneeType==''){
                    this.$notification.error({
                        message: '转办提示',
                        description: `转办签收人类型不能为空`
                    })
                    return
                }
                if(this.transferForm.transferAssigneeId==''){
                    this.$notification.error({
                        message: '转办提示',
                        description: `转办签收人不能为空`
                    })
                    return
                }
                let param={taskId:this._props.comData.taskId,busNo:this._props.comData.busNo,transferAssigneeType:this.transferForm.transferAssigneeType,transferAssigneeId:this.transferForm.transferAssigneeId};
                //发送请求获取可驳回节点
                this.$http.post(turnTask,param).then(() => {
                    this.transferLoading=false;
                    this.transferVisible=false;
                    this.$emit('Refresh');
                    this.$notification.success({
                        message: '转办提示',
                        description: `转办成功`
                    })
                }).catch(() => {
                    this.transferLoading=false;
                })
            },
            //驳回
            callback(){
                let param={taskId:this._props.comData.taskId,processInstanceId:this._props.comData.procInstId};
                this.dictData.backToActId=[];
                //发送请求获取可驳回节点
                this.$http.post(getBackNodeList,param).then((res) => {
                    if(res.result.length>0){
                        this.dictData.backToActId=res.result;
                        //没有可以驳回的节点时不显示驳回窗口
                        this.callbackVisible=true;
                    }else{
                        this.$notification.success({
                            message: '驳回提示',
                            description: `没有可以驳回的环节`
                        })
                    }
                }).catch(() => {

                })

            },
            //加签
            apostille(){

            },
            //审核提交
            approve(authstatus){
                if(this.infoCompleteFlag==false&&authstatus==='1'){
                    modal.info({ title: '提示', content: '当前环节信息填写不完整或有材料未上传无法审核通过！' });
                    return;
                }
                if(authstatus=='1'){
                    if(this.auditForm.shyj==''){
                        this.auditForm.shyj='审核通过';
                    }
                }
                if(authstatus=='2'){
                    if(this.auditForm.shyj==''){
                        this.auditForm.shyj='审核不通过';
                    }
                }
                this.allComponentsVo.executionId=this._props.comData.executionId;
                this.allComponentsVo.authStatus=authstatus;
                this.allComponentsVo.busNo=this._props.comData.busNo;
                this.allComponentsVo.authRemarks=this.auditForm.shyj;
                this.allComponentsVo.taskId=this._props.comData.taskId;
                //this.allComponentsVo.assigneeType=this.auditForm.assigneeType;
                //this.allComponentsVo.assigneeId=this.auditForm.assigneeId;
                //this.allComponentsVo.assigneeUserId=this.auditForm.userId;
                this.allComponentsVo.auUserId=this.auditForm.assigneeId;
                this.allComponentsVo.auRoleId=this.auditForm.assigneeId;
                this.allComponentsVo.auOrgId=this.auditForm.assigneeId;
                this.allComponentsVo.auGroupId=this.auditForm.assigneeId;

                this.auditDisable=true;
                this.$http.post(taskComplete,this.allComponentsVo).then((res) => {
                    if(res.result.reportList!=undefined){
                        if(res.result.reportList.length>0){
                            this.$router.push({name: "reportPrint", params: {"reportData":res.result.reportList}});
                        }
                    }
                    this.auditVisible=false;
                    this.auditForm.shyj='';
                    this.$emit('Refresh');
                }).catch(() => {
                    this.auditDisable=false;
                })
            },
            //驳回提交
            callBackSave(){
                if(this.callbackForm.backToActId){
                    this.callBackLoading = true;
                    //发送驳回请求
                    let param={backToActId:this.callbackForm.backToActId,taskId:this._props.comData.taskId,busNo: this._props.comData.busNo,authRemarks:this.callbackForm.bhyj};
                    this.$http.post(backToStepTask,param).then(() => {
                        this.$notification.success({
                            message: '驳回提示',
                            description: `驳回成功`
                        })
                        this.callBackLoading = false;
                        this.callbackVisible=false;
                        this.$emit('Refresh');
                    }).catch(() => {
                        this.callBackLoading = false;
                        this.$notification.error({
                            message: '驳回提示',
                            description: `驳回失败`
                        })
                    })
                }else{
                    this.$notification.error({
                        message: '驳回提示',
                        description: `驳回请先选择需要驳回的环节`
                    })
                }


            },
            //关闭审核窗口
            onAuditClose(){
                this.auditVisible=false;
            },
            //获取转办字典树
            getTrunAssigneeId(){
                //类型发生改变清空原有数据
                this.transferForm.transferAssigneeId='';
                let param={taskId:this._props.comData.taskId,assigneeType:this.transferForm.transferAssigneeType};
                //获取转办字典树
                this.$http.post(getTrunTaskAssigneeId,param).then((res) => {
                    if(this.transferForm.transferAssigneeType==2){
                        this.transferTreeFlag=true;
                        this.transferAssigneeTreeDict=res.result;
                    }else{
                        this.transferTreeFlag=false;
                        this.transferAssIdDict=res.result;
                    }
                }).catch(() => {

                })
            },
            onChangeOrgSelectTree (value) {
                console.log(value)
                this.orgSelectTreeValue = value
            },
            onSearchOrgSelectTree () {
                console.log(...arguments)
            },
            onSelectOrgSelectTree () {
                console.log(...arguments)
            },

            //批量打包下载
            downloadZip(){
                let param='';
                param='busNo='+this._props.comData.busNo;
                param+='&zipName='+this._props.comData.zipName;
                let a = document.createElement('a')
                let fileApiVersion=process.env.VUE_APP_FILE_VERSION;
                if(fileApiVersion=='old'){
                    a.href =downloadMaterialZip+"?"+param;
                }else{
                    a.href =downloadFileZip+"?"+param;
                }

                a.click();
            },
            //动态注册子组件
            importComponets(formkeyList){
                formkeyList.map((el) => {
                    let reauditElement = reauditConfig.reMap.get(el);
                    if (reauditElement !== undefined) {
                        this.$options.components[el] = reauditElement.default || reauditElement
                        this.allComponents=formkeyList;
                        this.$forceUpdate()
                    }
                });
            }
        }
    }
</script>